// import store from '@/store/index.js'
// 用户相关请求模块
// 导入基础路径
import request from '@/utils/request.js'

// 请求登录
export const login = function (data) {
  return request({
    method: 'POST',
    url: '/app/v1_0/authorizations',
    data: data
  })
}
// 获取验证码
export const sendSms = function (mobile) {
  return request({
    method: 'GET',
    url: `/app/v1_0/sms/codes/${mobile}`
  })
}
// 获取用户自己的信息
export const getUserInfo = function () {
  return request({
    method: 'GET',
    url: '/app/v1_0/user'
    // 发送请求头数据
    // 注意该接头需要请求头才可以访问
    // headers: {
    //   Authorization: `Bearer ${store.state.user.token}`
    // }
  })
}
// 获取获取用户频道信息
export const getUserChannels = function () {
  return request({
    method: 'GET',
    url: '/app/v1_0/user/channels'
    // 发送请求头数据
    // 注意该接头需要请求头才可以访问
    // headers: {
    //   Authorization: `Bearer ${store.state.user.token}`
    // }
  })
}
// 用户点击关注
export const addFollow = function (target) {
  return request({
    method: 'POST',
    url: '/app/v1_0/user/followings',
    data: {
      target
    }
  })
}
// 用户取消关注
export const deleteFollow = function (target) {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/user/followings/${target}`

  })
}
// 获取个人资料
export const getUserProfile = function () {
  return request({
    method: 'GET',
    url: '/app/v1_0/user/profile'

  })
}
// 更新个人资料
export const updataUserProfile = function (data) {
  return request({
    method: 'PATCH',
    url: '/app/v1_0/user/profile',
    data

  })
}
// 更新个人头像
export const updataUserPhoto = function (data) {
  return request({
    method: 'PATCH',
    url: '/app/v1_0/user/photo',
    data

  })
}
